package com.doll.util.test;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Session;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.junit.Test;

public class ActiveMQSample {
	@Test
	public void test() throws Exception{
		
		final ConnectionFactory connFactory = new ActiveMQConnectionFactory();
		 
	    final Connection conn = connFactory.createConnection();
	    
	    final Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
	     
	    final Destination dest = sess.createQueue("SampleQueue");
	 
	    final MessageProducer prod = sess.createProducer(dest);
	 
	    final Message msg = sess.createTextMessage("Simples Assim");
	 
	    prod.send(msg);
	 
	    conn.close();
	}
}
